import { Channel } from '@/types/data'

const CHANNEL_KEY = 'geek-channels'

/**
 * 保存频道数据到本地
 */

export function setChannels(channels: Channel[]) {
  localStorage.setItem(CHANNEL_KEY, JSON.stringify(channels))
}

/**
 * 从本地获取频道数据
 */

export function getChannels(): Channel[] {
  return JSON.parse(localStorage.getItem(CHANNEL_KEY) || '[]')
}
